package com.slorgs.infrastructure.mapper

import com.baomidou.mybatisplus.core.mapper.BaseMapper
import com.baomidou.mybatisplus.core.metadata.IPage
import com.baomidou.mybatisplus.extension.plugins.pagination.Page
import com.gateway.common.model.ApiGroup
import com.gateway.common.model.Environment
import com.slorgs.infrastructure.dto.*
import com.slorgs.infrastructure.model.Api
import org.apache.ibatis.annotations.Param

interface ApiMapper : BaseMapper<Api> {


    fun selectList(page: Page<*>?, @Param("obj") api: Api?): IPage<ApiDTO?>?

    fun selectApiList(
        page: Page<*>?,
        @Param("obj") apiGroupDTO: ApiGroupDTO?,
        @Param("isManager") isManager: Boolean,
        @Param("user") user: String?
    ): IPage<ApiGroupDTO?>?

    fun insertApi(@Param("obj") api: com.gateway.common.model.Api?): Int

    fun selectGroup(): List<ApiGroup?>?

    fun update(@Param("obj") api: com.gateway.common.model.Api?): Int

    fun selectEnv(): List<Environment?>?

    fun selectApiAuditByApi(
        page: Page<*>?,
        @Param("api") idApi: String?,
        @Param("status") status: Int,
        @Param("name") name: String?
    ): IPage<LinkLoggerDTO?>?

    fun selectApiPathCount(path: String?): Int

    fun deleteApiMappingApp(idApi: String?): Int

    fun deleteLinkLogByApi(idApi: String?): Int

    fun deleteApiById(idApi: String?): Int

    fun statistics(): List<ApiStatisticsDTO?>?

    fun success_rate(): SuccessRate?

    fun countByApi(): List<APICountDTO?>?
}